<template>
  <view>
    <view>
      <view style="margin: 80px 0 4px 0">
        <view style="font-size: 20px; text-align: center; color: #555">欢迎使用智慧捷登活动管理</view>
        <view class="main-content"> 部分表单涉及个人信息的收集，仅用于活动举办方与您的联系，开始使用应用前，请阅读《用户服务协议》及《隐私政策》 </view>
      </view>
      <u-button :disabled="isReadPrivacy == 'N'" @click="navToAdmin" :customStyle="cStyle" type="primary" text="进入应用" shape="circle"></u-button>
    </view>
    <view class="agree-checked">
      <u-checkbox-group v-model="checked" @change="handleChecked">
        <u-checkbox label=" " name="agree"></u-checkbox>
      </u-checkbox-group>
      我已阅读并同意<span style="color: #398ade" @click="handleOpenPrivacyContract">《用户服务协议》及《隐私政策》</span>
    </view>
  </view>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
  data() {
    return {
      cStyle: {
        width: '80%',
      },
      showPrivacy: true,
      checked: [],
    }
  },
  computed: {
    ...mapGetters(['isReadPrivacy']),
  },
  onLoad() {
    if (this.isReadPrivacy == 'Y') return this.navToAdmin()
  },
  methods: {
    handleChecked(e) {
      this.$store.commit('setReadStatus', e.length > 0 ? 'Y' : 'N')
    },
    handleAgreePrivacyAuthorization() {
      // 用户同意隐私协议事件回调
      // 用户点击了同意，之后所有已声明过的隐私接口和组件都可以调用了
      // wx.getUserProfile()
      // wx.chooseMedia()
      // wx.getClipboardData()
      // wx.startRecord()
    },
    handleOpenPrivacyContract() {
      // 打开隐私协议页面
      // uni.openPrivacyContract({
      //   success: () => {}, // 打开成功
      //   fail: () => {}, // 打开失败
      //   complete: () => {},
      // })
      uni.$u.route('/pages/Privacy')
    },
    navToAdmin() {
      uni.$u.route({ type: 'reLaunch', url: '/pages/autoform/admin/index' })
    },
  },
}
</script>
<style>
.agree-checked {
  margin-top: 18px;
  justify-content: center;
  font-size: 13px;
  display: flex;
  align-items: center;
}
.main-content {
  padding: 10px 18px;
  letter-spacing: 1px;
  color: #777;
  font-size: 15px;
  line-height: 32px;
}
</style>
